﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.OracleClient;

namespace Userinterface_Ver._1_
{
    public partial class frmCapNhatKH : DevComponents.DotNetBar.Office2007Form
    {
        //private BindingManagerBase mrg;
        public frmCapNhatKH()
        {
            InitializeComponent();
        }

        private void frmCapNhatKH_Load(object sender, EventArgs e)
        {
            ////clsConnectDatabase.con.Open();
            ////tạo đối tượng datadapter
            string sql = "select * from KHACH_HANG where KHACH_HANG.MA_KH='" + frmKhachHang.makh + "'";
            OracleDataAdapter da = new OracleDataAdapter(sql,clsConnectDatabase.con);
            DataSet ds = new DataSet();
            da.Fill(ds,"KHACH_HANG");
            txtMaKH.DataBindings.Add("text",ds,"KHACH_HANG.MA_KH");
            txtTenKH.DataBindings.Add("text",ds,"KHACH_HANG.TEN_KH");
            txtNamSinh.DataBindings.Add("text", ds, "KHACH_HANG.NGAY_SINH_KH");
            txtSoDTKH.DataBindings.Add("text", ds, "KHACH_HANG.SO_DT_KH");
            txtSoTKKH.DataBindings.Add("text", ds, "KHACH_HANG.SO_TK_KH");
            txtDiaChiKH.DataBindings.Add("text", ds, "KHACH_HANG.DIA_CHI_KH");
           
        }

        private void btnThoat_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        private void btnLuu_Click(object sender, EventArgs e)
        {
            string sql = "update KHACH_HANG set TEN_KH='" + txtTenKH.Text + "' where MA_KH='" + frmKhachHang.makh + "'";
            OracleCommand com = new OracleCommand(sql,clsConnectDatabase.con);
            com.ExecuteNonQuery();
            string sql1 = "update KHACH_HANG set NGAY_SINH_KH='" + txtNamSinh.Text + "' where MA_KH='" + frmKhachHang.makh + "'";
            OracleCommand com1 = new OracleCommand(sql1, clsConnectDatabase.con);
            com1.ExecuteNonQuery();
        }
    }
}
